public class test_11_24_0_1 {

    public String name="admin";
    public String password="123456";

    public void login(String name,String password) throws UserNameException,PassWordException{
        if(!this.name.equals(name)){
            System.out.println("用户名错误！！！");
            throw new UserNameException("输入的用户名错误，请查询后重新输入！！！");

        }
        if(!this.password.equals(password)){
            System.out.println("密码错误！！！");
            throw new PassWordException("输入的密码错误，请查询后重新输入！！！");
        }
    }

    public static void main(String[] args) {
        test_11_24_0_1 t=new test_11_24_0_1();
        try{
            t.login("admin","123456");
        }catch (UserNameException e){
            e.printStackTrace();
            System.out.println("用户名异常！");
        }catch (PassWordException p){
            p.printStackTrace();
            System.out.println("密码异常！");
        }finally{
            System.out.println("呵呵》》");
        }
    }



}





